package service

import (
	"gin_cli/models"
)

func GetMemberUserInfo(id int64) models.Member {
	data := new(models.Member).GetById(id)
	return data
}

func GetMemberMcoin(id int64, deivceNo string) int64 {
	if deivceNo == "" {
		return 0
	}
	where := make(map[string]interface{})
	where["device_number"] = deivceNo
	device := new(models.Device).GetInfo(where, "")

	if device.StoreId == 0 {
		return 0
	}
	merchantID := new(models.MerchantStore).GetMerchantIdByStoreId(device.StoreId)
	if merchantID == 0 {
		return 0
	}
	Mcoin := new(models.RelMemberMcoin).GetMcoin(int64(id), merchantID)

	return Mcoin
}
